import { px } from '@/utils/utils';
export const basePipConf = (() => {
  return {
    tooltip: {
      trigger: 'item',
      show: false,
      appendToBody: true
    },
    legend: {
      type: 'scroll',
      selectedMode: false,
      orient: 'vertical',
      icon: 'circle',
      itemWidth: px(10),
      itemHeight: px(10),
      itemGap: px(8),
      textStyle: {
        color: '#fff',
        fontSize: px(12),
        lineHeight: px(15),
        rich: {
          green: {
            color: 'rgba(59, 233, 168, 1)',
            align: 'left',
            fontSize: px(16),
            fontWeight: 'bold',
            padding: [0, 0, 0, 0]
          },
          orange: {
            color: 'rgba(242, 191, 100, 1)',
            align: 'left',
            fontSize: px(16),
            fontWeight: 'bold',
            padding: [0, 0, 0, 0]
          },
          red: {
            color: 'rgba(255, 118, 145, 1)',
            align: 'left',
            fontSize: px(16),
            fontWeight: 'bold',
            padding: [0, 0, 0, 0]
          },
          blue: {
            color: 'rgba(2, 150, 226, 1)',
            align: 'left',
            fontSize: px(16),
            fontWeight: 'bold',
            padding: [0, 0, 0, 0]
          }
        }
      },
      data: [
        {
          name: '已完成',
          itemStyle: {
            color: 'rgba(63, 207, 154, 1)'
          }
        },
        {
          name: '已暂停',
          itemStyle: {
            color: 'rgba(222, 110, 131, 1)'
          }
        },
        {
          name: '未评价',
          itemStyle: {
            color: 'rgba(228, 185, 110, 1)'
          }
        }
      ],
      padding: 0,
      pageIconColor: 'rgba(0,159,255,1)',
      pageIconInactiveColor: 'rgba(0,159,255,0.4)',
      pageTextStyle: {
        color: '#fff'
      }
    },
    series: [
      {
        type: 'pie',
        center: ['28%', '50%'],
        left: px(12),
        top: 'center',
        width: '60%',
        height: '80%',
        radius: ['70%', '90%'],
        avoidLabelOverlap: false,
        label: {
          formatter: '{d}%',
          color: '#ACE9EF',
          fontSize: px(12),
          show: false
        },
        itemStyle: {
          opacity: 1,
          color: function(params) {
            // 为每个扇区设置不同的渐变色
            const colorList = [
              {
                type: 'linear',
                x: 0,
                y: 0,
                x2: 1,
                y2: 1,
                colorStops: [
                  { offset: 0, color: 'rgba(63, 207, 154, 0)' }, // 起始颜色
                  { offset: 0.5, color: 'rgba(63, 207, 154, 1)' } // 结束颜色
                ]
              },
              {
                type: 'linear',
                x: 0,
                y: 0,
                x2: 1,
                y2: 1,
                colorStops: [
                  { offset: 0, color: 'rgba(222, 110, 131, 0)' }, // 起始颜色
                  { offset: 0.5, color: 'rgba(222, 110, 131, 1)' } // 结束颜色
                ]
              },
              {
                type: 'linear',
                x: 0,
                y: 0,
                x2: 1,
                y2: 1,
                colorStops: [
                  { offset: 0, color: 'rgba(228, 185, 110, 0)' }, // 起始颜色
                  { offset: 0.5, color: 'rgba(228, 185, 110, 1)' } // 结束颜色
                ]
              }
            ];
            return colorList[params.dataIndex % colorList.length]; // 循环使用渐变色
          }
        },
        labelLine: {
          show: false,
          length: 5,
          length2: 5
        },
        data: []
      }
    ]
  };
})();
